﻿using System;
using System.Collections.Generic;
using System.Numerics;

class MinMaxAvSumProd
{
    static void MinElement(int[] array, int dimention)
    {
        int minElement = array[0];
        for (int index = 1; index < dimention; index++)
        {
            if (array[index] < minElement)
            {
                minElement = array[index];
            }
        }
        Console.WriteLine("The min element in the array is: {0}",minElement);
    }
    static void MaxElement(int[] array, int dimention)
    {
        int maxElement = array[0];
        for (int index = 1; index < dimention; index++)
        {
            if (array[index] > maxElement)
            {
                maxElement = array[index];
            }
        }
        Console.WriteLine("The max element in the array is: {0}", maxElement);
    }
    static void AverageElement(int[] array, int dimention)
    {
        Array.Sort(array);
        Console.WriteLine("The average of the elements is {0}",array[dimention/2]);
    }
    static void SumOfElements(int[] array, int dimention)
    {
        BigInteger Sum = 0;
        for (int index = 0; index < dimention; index++)
        {
            Sum += array[index];
        }
        Console.WriteLine("The sum of the elements is {0}",Sum);
    }
    static void ProductOfElements(int[] array, int dimention)
    {
        BigInteger Product = 1;
        for (int index = 0; index < dimention; index++)
        {
            Product *= array[index];
        }
        Console.WriteLine("The product of the elements is {0}", Product);
    }
    static void Main()
    {
        Console.WriteLine("Enter the length of the array:");
        int arrayLength = int.Parse(Console.ReadLine());
        int[] arrayOfInts = new int[arrayLength];
        Console.WriteLine("Enter the elements of the array:");
        for (int i = 0; i < arrayLength; i++)
        {
            Console.WriteLine("Enter element {0}", i);
            arrayOfInts[i] = int.Parse(Console.ReadLine());
        }
        Console.WriteLine("The array you entered is:");
        for (int j = 0; j < arrayLength; j++)
        {
            Console.WriteLine(arrayOfInts[j]);
        }
        Console.WriteLine();
        MinElement(arrayOfInts, arrayLength);
        Console.WriteLine();
        MaxElement(arrayOfInts, arrayLength);
        Console.WriteLine();
        AverageElement(arrayOfInts, arrayLength);
        Console.WriteLine();
        SumOfElements(arrayOfInts, arrayLength);
        Console.WriteLine();
        ProductOfElements(arrayOfInts, arrayLength);
    }
}

